#include <stdio.h>
#include<sys/types.h>
#include<unistd.h>
#include<sys/wait.h>
#include<stdlib.h>
int main()
{
        printf("我的程序要运行了！\n");

       char *const argv[]={(char* const)"mypro",(char* const)"-l",NULL};

       char* const env[]={(char* const)"AAA=12345",(char* const)"BBB=54321",NULL};
        if(fork()==0)
        {
        printf("我是子进程，我的pid：%d\n",getpid());
        //putenv((char* const)"AAA=12345");
       // putenv((char* const)"BBB=54321");
       for(int i=0;env[i];i++)
       {
           putenv(env[i]);
       }
        extern char** environ;
        execvpe("./mypro",argv,environ);
        exit(1);
        }

        waitpid(-1,NULL,0);
        printf("我的程序运行结束了！\n");


   return 0;
}
